package com.google.gwt.livinglife.client.widgets;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.livinglife.client.data.BasicPostData;
import com.google.gwt.livinglife.client.data.UserIdData;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;

public class AuthoredTextBox extends Composite implements ClickHandler {
	private Hyperlink author_link; 
	private Label text_widget;
	private FlowPanel panel = new FlowPanel();
	private BasicPostData post;
	
	public AuthoredTextBox(BasicPostData post) {
		this.post = post;
		author_link = new Hyperlink( post.getAuthor().getNickname(), "User_"+ post.getAuthor().getId());
		text_widget = new Label(post.getPost_text());
		panel.add(author_link);
		panel.add(text_widget);
		initWidget(panel);
		Image embedded_image;
		// Give the overall composite a style name.
		setStyleName("AuthoredTextBox");
		if (post.getEmbeded_image() != null) {
			embedded_image = new Image();
			embedded_image.setHeight("20px");
			embedded_image.setUrl(post.getEmbeded_image());
			panel.add(embedded_image);
		}
	}
	public void onModuleLoad() {
	}

	public void onClick(ClickEvent event) {
		Object sender = event.getSource();
		if (sender == author_link) {
		}
	}

}
